﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using HAOest.Diandi.Model;
using HAOest.Diandi.Services.BizFacade;

namespace HAOest.DianDi.UI
{
    /// <summary>
    /// AddNoteDialog.xaml 的交互逻辑
    /// </summary>
    public partial class AddNoteDialog : Window
    {
        public AddNoteDialog()
        {
            InitializeComponent();
        }

        public static bool? ShowDialog(Window window)
        {
            AddNoteDialog addNoteDialog = null;
            addNoteDialog = new AddNoteDialog();
            if (addNoteDialog != null)
            {
                addNoteDialog.Owner = window;
                return addNoteDialog.ShowDialog().Value;
            }
            return null;
        }

        private void btnOk_Click(object sender, RoutedEventArgs e)
        {
            NoteItem noteItem = new NoteItem();
            noteItem.ContentText = noteItemContentText.Text;
            noteItem.Date = DateTime.Now;
            NoteItemFacade.InsertNoteItem(noteItem);
        }

        private void btnCancel_Click(object sender, RoutedEventArgs e)
        {
            this.DialogResult = false;
        }

        private void Window_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            this.DragMove();
        }
    }
}
